// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import iView from 'view-design'
import { DatePicker } from 'element-ui';
import ElementLocale from 'element-ui/lib/locale'
import 'element-ui/lib/theme-chalk/index.css';
import enLocale from 'element-ui/lib/locale/lang/en'// element-ui 英语语言包
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'// element-ui 中文语言包

import i18nV from '@/locale'
import VueI18n from 'vue-i18n'// 引入element国际化
import config from '@/config'
import importDirective from '@/directive'
import installPlugin from '@/plugin'
import './custom.less'
import './index.less'
// import '@/assets/icons/iconfont.css'

// 引入全局uView
import cuView from './cuview-ui'
import math from '@/libs/math.js'
import vuexStore from '@/store/$u.mixin.js'
require('./libs/echarts')
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
Vue.use(Viewer);
Viewer.setDefaults({
  Options: { "inline": true, "button": true, "navbar": true, "title": true, "toolbar": true, "tooltip": true, "movable": true, "zoomable": true, "rotatable": true, "scalable": true, "transition": true, "fullscreen": true, "keyboard": true, "url": "data-source" }
});
Vue.use(iView, {
  i18n: (key, value) => i18nV.t(key, value)
})

Vue.component(DatePicker.name, DatePicker);
Vue.use(VueI18n)

Vue.use(cuView)
Vue.mixin(vuexStore)
Vue.prototype.$math = math;
const messages = {
  en: {
    message: 'hello',
    ...enLocale,
  },
  zh: {
    message: '你好',
    ...zhLocale,
  }
}
const i18n = new VueI18n({
  locale: 'zh', // set locale
  messages, // set locale messages
})
ElementLocale.i18n((key, value) => i18n.t(key, value))
/**
 * @description 注册admin内置插件
 */
installPlugin(Vue)
/**
 * @description 生产环境关掉提示
 */
Vue.config.productionTip = false
/**
 * @description 全局注册应用配置
 */
Vue.prototype.$config = config
/**
 * 注册指令
 */
importDirective(Vue)
// Vue.directive('clickOutside', clickOutside)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  i18n,
  store,
  render: h => h(App)
})
